$(function(){
	
	document.documentElement.style.fontSize = window.innerWidth/3.75 + 'px';
	
	var data = {};
	var userId = getQueryStr("userId");
	var carType = getQueryStr("carType");
	data.city = decodeURI(getQueryStr("city"));
	data.date = decodeURI(getQueryStr("orderCreateTime"));
	var orderStatus = getQueryStr("orderStatus");
    if(carType == "1"){
    	data.topImg = "img/dongfeng_banner.jpg";
    	data.modalImg = "img/AX7 2.0L_peizhi.png";
    	data.carStyle = "AX72.0L自动智逸型";
    }
    if(carType == "2"){
    	data.topImg = "img/dongfeng_banner.jpg";
    	data.modalImg = "img/AX7 1.4T_peizhi.png";
    	data.carStyle = "AX71.4T手动智悦型";
    }
    if(carType == "3"){
    	data.topImg = "img/yage_banner.jpg";
    	data.modalImg = "img/yagejy_peizhi.jpg";
    	data.carStyle = "雅阁2.0精英版";
    }
    if(carType == "4"){
    	data.topImg = "img/yage_banner.jpg";
    	data.modalImg = "img/yagess_peizhi.jpg";
    	data.carStyle = "雅阁2.0舒适版";
    }
    if(orderStatus == "1"){
    	data.status = "已预约";
    }
	var tpl = document.getElementById("tpl").innerHTML;
	var html = juicer(tpl,data);
	$(".spec-body").html(html);
	
	var identifyId = getQueryStr("identifyId");
	
	
	//取消订单
	$(".cancel").on("click",function(){
		$.ajax({
	      type: "post",
	      url: "/dingding-web/rentSaleCarActiceAction!cancelRentSaleOrder.action",
	      dataType: "jsonp",
	      async: false,
	      jsonp: "callback",
	      jsonpCallback: "success_jsop",
	      data: {
	      	userId: userId
	      },
	      success: function(data){
        	swal({
	            title: data.errorMessage,
	            type: "warning",
	            confirmButtonColor: "#DD6B55",
	            confirmButtonText: "确定",
	        },function(){
	        	if(carType == "1" || carType == "2"){
	        		window.location.href = "base_index.html?bizId=5&userId=" + userId +"&identifyId="+identifyId+"&cityNo="+getQueryStr("cityNo");
	        	}
	        	if(carType == "3" || carType == "4"){
	        		window.location.href = "base_index.html?bizId=6&userId=" + userId +"&identifyId="+identifyId+"&cityNo="+getQueryStr("cityNo");
	        	}
	        });
	      }
	    });
	});
	if(identifyId != "999"){
	      $(".close-icon").remove();
	}
	$(".close-icon").on("click",function(){
	      window.history.back();
	    })
});
